package com.dahua.messagesyncsh.common.result;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
public class ResultVO<T> {
    private Integer code;

    private String message;

    private T data;

    public ResultVO(T data) {
        this.code = Code.SUCCESS.getCode();
        this.message = Code.SUCCESS.getMessage();
        this.data = data;
    }

    /*  legal in overload*/
    public ResultVO(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public ResultVO(Code code) {
        this.code = code.getCode();
        this.message = code.getMessage();
    }

    public ResultVO(Code code, String message) {
        this.code = code.getCode();
        this.message = message;
    }

    public ResultVO(Code code, T data) {
        this.code = code.getCode();
        this.message = code.getMessage();
        this.data = data;
    }

    public ResultVO(Code code, String message, T data) {
        this.code = code.getCode();
        this.message = message;
        this.data = data;
    }

}
